package com.ticket.sass.common.entity.tenant;

import com.baomidou.mybatisplus.annotation.*;
import com.ticket.sass.common.entity.tenant.enums.CouponUserMapUseState;
import com.ticket.sass.common.entity.tenant.enums.UserCouponSourceType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 优惠券领取表
 * </p>
 *
 * @author ywb
 * @since 2024-03-13
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("coupon_user_maps")
@ApiModel(value="CouponUserMapsEntity对象", description="优惠券领取表")
public class CouponUserMapEntity implements Serializable {
    @ApiModelProperty(value = "优惠券领取ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "券码")
    private String code;

    @ApiModelProperty(value = "优惠券 id")
    private Long couponId;

    @ApiModelProperty(value = "用户 id")
    private Long userId;

    @ApiModelProperty(value = "使用状态：未使用，已使用")
    private CouponUserMapUseState useState;

    @ApiModelProperty(value = "有效开始时间")
    private LocalDateTime validStartTime;

    @ApiModelProperty(value = "有效结束时间")
    private LocalDateTime validEndTime;

    @ApiModelProperty(value = "租户 id")
    private Long tenantId;
    
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    public LocalDateTime createdAt;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    public LocalDateTime updatedAt;

    @ApiModelProperty(value = "来源id")
    public Long sourceId;

    @ApiModelProperty(value = "来源类型")
    public UserCouponSourceType sourceType;

    @TableField(select = false)
    @ApiModelProperty(value = "删除时间")
    @TableLogic(value = "null", delval = "now()")
    public LocalDateTime deletedAt;

    @TableField(exist = false)
    private CouponEntity coupon;

    @TableField(exist = false)
    private List<CouponWeekEntity> couponWeeks;

    @TableField(exist = false)
    private List<CouponCommodityMapEntity> couponCommodityMaps;

    @TableField(exist = false)
    private List<CouponFilmMapEntity> couponFilmMaps;

    @TableField(exist = false)
    private List<CouponHallMapEntity> couponHallMaps;
}
